package com.example.board_jojo;

import android.app.Activity;
import android.os.Bundle;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Menu;
import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
import android.widget.TextView;

public class ViewActivityk extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_viewk);
		TextView tv1 = (TextView)findViewById(R.id.textView1);
		TextView tv2 = (TextView)findViewById(R.id.textView2);
		TextView tv3 = (TextView)findViewById(R.id.textView3);
		
		
		registerForContextMenu(tv1);
		registerForContextMenu(tv2);
		registerForContextMenu(tv3);
		
		
		
	
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// Handle action bar item clicks here. The action bar will
		// automatically handle clicks on the Home/Up button, so long
		// as you specify a parent activity in AndroidManifest.xml.
		new MainOptionMenu(this, item);
		return super.onOptionsItemSelected(item);
	}

	@Override
	public void onCreateContextMenu(ContextMenu menu, View v,
			ContextMenuInfo menuInfo) 
	{
		int id = v.getId();
		switch(id)
		{
		case R.id.textView2 :
			menu.add(0,1,0,"마동석");
			menu.add(0,2,0,"원빈");
			break;
			
		case R.id.textView1 :
			menu.add(0,3,0,"한지민");
			menu.add(0,4,0,"수지");
			menu.add(0,5,0,"아이유");
			break;
			
		case R.id.textView3 :
			SubMenu sm1 = menu.addSubMenu("청순한~");
			SubMenu sm2 = menu.addSubMenu("예쁜~");
			
			sm1.add(0,6,0, "아이유");
			sm1.add(0,7,0,"수지");
			
			sm2.add(0,8,0, "가인");
			sm2.add(0,9,0,"ㅇㅂㅂ");
			break;
		}
		super.onCreateContextMenu(menu, v, menuInfo);
	}

	@Override
	public boolean onContextItemSelected(MenuItem item) 
	{
		
		return super.onContextItemSelected(item);
	}
}

